package com.xuxin.pda.presenter;

import com.xuxin.pda.bean.BaseBean;
import com.xuxin.pda.bean.DptBean;
import com.xuxin.pda.bean.MemberBean;
import com.xuxin.pda.contract.PrintContract;
import com.xuxin.pda.model.PrintModel;

/**
 * Created by xu_xin
 * Created on 2021/2/18 0018
 */
public class PrintPresenter implements PrintContract.Presenter {
    private final PrintModel model;
    private final PrintContract.View view;

    public PrintPresenter(PrintContract.View view) {
        this.view = view;
        model = new PrintModel();
    }

    @Override
    public void getDptList() {
        if (null != model) {
            model.getDptList(this);
        }
    }

    @Override
    public void getMemberList() {
        if (null != model) {
            model.getMemberList(this);
        }
    }

    @Override
    public void onSuccess(DptBean dptBean) {
        if (null != view) {
            view.onSuccess(dptBean);
        }
    }

    @Override
    public void onSuccess(MemberBean memberBean) {
        if (null != view) {
            view.onSuccess(memberBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}